package com.potenza.training.resume.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.potenza.training.resume.dao.SocialDao;
import com.potenza.training.resume.entity.SocialEntity;
import com.potenza.training.resume.service.SocialService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("socialService")
public class SocialServiceImpl extends ServiceImpl<SocialDao, SocialEntity> implements SocialService {

    @Autowired
    SocialDao socialDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<SocialEntity> page = this.page(
                new Query<SocialEntity>().getPage(params),
                new QueryWrapper<SocialEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<SocialEntity> findByresumeId(Integer resumeId) {
        QueryWrapper<SocialEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(SocialEntity::getResumeId,resumeId);
        return socialDao.selectList(queryWrapper);
    }

}